FROM golang:1.17-alpine3.16 AS builder

ENV GO111MODULE=on \
    GOPROXY=https://goproxy.cn,direct

COPY . /go/src/coolvar/server

WORKDIR /go/src/coolvar/server
RUN go install ./gateway/...

FROM alpine:3.16
COPY --from=builder /go/bin/gateway /bin/gateway
ENV ADDR=:8080

EXPOSE 8080

ENTRYPOINT [ "/bin/gateway" ]